package com.multiple.activities;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MultipleActivitiesActivity extends Activity implements OnClickListener {
	AlertDialog.Builder alert;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Button button = (Button) findViewById(R.id.buttonswitch);
        button.setOnClickListener(this);
        button.setText("Start Calculator");
        
        alert = new AlertDialog.Builder(this);
        alert.setTitle("Warning!");
        alert.setMessage("This will continue to Calculator. Are you sure you wish to continue?");
        alert.setPositiveButton("Continue", new DialogInterface.OnClickListener(){

			public void onClick(DialogInterface dialog, int which) {
				Intent intents = new Intent(MultipleActivitiesActivity.getContext(), CalculatorActivity.class);
				MultipleActivitiesActivity.getContext().startActivity(intents);
			}
        	
        });
        
        alert.setNegativeButton("Halt!", new DialogInterface.OnClickListener(){
			public void onClick(DialogInterface dialog, int which) {
				
			}
        });
    }
	protected static Context getContext() {
		// TODO Auto-generated method stub
		return null;
	}
	public void onClick(View v) {
		alert.show();
	}
}